<a style="cursor: pointer;" onclick="history.back()">Back to Search Results</a>
<h1>Schedules available for 
<?php
	$this->db->select("lastname, firstname");
	$this->db->from("teachers");
	$this->db->where("userid", $teacherid);
	$query = $this->db->get();
	
	foreach($query->result() as $row){
		echo $row->firstname . " " . $row->lastname;
	}
?>
:</h1>
<?php
	$constraints = array(
	                     "teacherid" => $teacherid,
	                     "subjectid" => $subjectid,
	                     "studentid" => NULL,
	                     "adminstatus" => "approved"
	                    );
	
	$schedule_query = $this->db->get_where("schedule", $constraints);
	$studentid = $this->session->userdata("userid"); //Assuming student is logged in
	
	foreach($schedule_query->result() as $row){
		$date = $row->date;
		$time = $row->time;
		echo "<a href='../../reserve/$teacherid/$date/" . str_replace(":", "-", $time) . "/$studentid'>";
		echo "$date, $time</a><br />";
	}
	
?>
